using System.Collections.Generic;
using Iesi.Collections.Generic;
using SharpArch.Core.DomainModel;


namespace NHibernateInsight.Tests.Domain
{
    public class Prospect : EntityWithTypedId<int>
    {
        [DomainSignature]
        public virtual string Sex
        {
            get;
            set;
        }

        [DomainSignature]
        public virtual string Initials
        {
            get;
            set;
        }

        [DomainSignature]
        public virtual string Prefix
        {
            get;
            set;
        }

        public virtual void RelateTo(Product product)
        {
            Products.Add(product);
            product.Prospects.Add(this);
        }
        public virtual void RelateTo(Order order)
        {
            order.Prospect = this;
            Orders.Add(order);
        }
        public virtual void RelateTo(Address address)
        {
            address.Prospect = this;
            Addresses.Add(address);
        }

        public virtual User User { get; set; }

        public virtual IList<Product> Products
        {
            get
            {
                return _products ?? (_products = new List<Product>());
            }
            set
            {
                _products = value;
            }
        }
        private IList<Product> _products;

        public virtual ISet<Product> ProductsSet
        {
            get
            {
                return _productsSet ?? (_productsSet = new HashedSet<Product>());
            }
            set
            {
                _productsSet = value;
            }
        }
        private ISet<Product> _productsSet;

        public virtual IList<Order> Orders
        {
            get
            {
                return _orders ?? (_orders = new List<Order>());
            }
            set
            {
                _orders = value;
            }
        }
        private IList<Order> _orders;

        public virtual ISet<Order> OrdersSet
        {
            get
            {
                return _ordersSet ?? (_ordersSet = new HashedSet<Order>());
            }
            set
            {
                _ordersSet = value;
            }
        }
        private ISet<Order> _ordersSet;

        public virtual IList<Address> Addresses
        {
            get
            {
                return _addresses ?? (_addresses = new List<Address>());
            }
            set
            {
                _addresses = value;
            }
        }
        private IList<Address> _addresses;

        public virtual ISet<Address> AddressesSet
        {
            get
            {
                return _addressesSet ?? (_addressesSet = new HashedSet<Address>());
            }
            set
            {
                _addressesSet = value;
            }
        }
        private ISet<Address> _addressesSet;
    }
}